﻿@model System.Data.DataTable
@using System.Data
@{

}
@functions{
    public string gettemptype(string type)
    {
        string restr = string.Empty;
        switch (type)
        {
            case "1":
                restr = "文本型栏目";
                break;
            case "2":
                restr = "栏目型栏目";
                break;
            case "3":
                restr = "Url转发型栏目";
                break;
            case "4":
                restr = "功能型栏目";
                break;
            default:
                restr = "未知栏目";
                break;
        }
        return restr;
    }
}
@section head{
    <title>栏目排序</title>
}
@section content{
    <div class="container-fluid mysite" id="BreadDiv">
        <div class="row">
            <ol id="BreadNav" class="breadcrumb navbar-fixed-top">
                <li>系统设置</li>
                <li>栏目管理</li>
            </ol>
        </div>
    </div>
    <form id="moveform" method="post">
        <table class="table table-striped table-bordered table-hover">
            <tr>
                <td class="td_s"><strong>ID</strong></td>
                <td><strong>栏目名</strong></td>
                <td><strong>节点类型</strong></td>
                <td class="td_m"><strong>手动排序</strong></td>
                <td><strong>排序</strong></td>
            </tr>
            @foreach (DataRow dr in Model.Rows)
            {
                <tr>
                    <td>@dr["TemplateID"]</td>
                    <td>@dr["TemplateName"]</td>
                    <td>@gettemptype(dr["templateType"].ToString())</td>
                    <td>
                        <input type="text" class="l_input" style="width:40px; text-align:center" name="OrderField@(dr["TemplateID"])" id="OrderField@(dr["TemplateID"])" value="@dr["OrderID"]" />
                        <input type="hidden" name="PageValue" id="SpecIDValue" value="@dr["TemplateID"]" />
                    </td>
                    <td>
                        <a href="javascript:;" onclick="UpMove(@dr["TemplateID"]);" class="option_style"><i class="fa fa-long-arrow-up"></i>上移</a>
                        <a href="javascript:;" onclick="DownMove(@dr["TemplateID"]);" class="option_style"><i class="fa fa-long-arrow-down"></i>下移</a>
                    </td>
                </tr>
            }
        </table>
        <button id="save_btn" type="button" onclick="BatchMove();" class="btn btn-primary">批量更新排序</button>
    </form>
}
@section script{
    <script>
        function BatchMove() {
            $("#moveform").attr("action", "@MVCHelper.GetAction("SetPageOrder_Batch",Request)").submit();
        }
        function UpMove(tid) {
            $("#moveform").attr("action", "@MVCHelper.GetAction("SetPageOrder_UpMove", Request)&tempid=" + tid).submit();
        }
        function DownMove(tid) {
            $("#moveform").attr("action", "@MVCHelper.GetAction("SetPageOrder_DownMove", Request)&tempid=" + tid).submit();
        }
    </script>
}